<template>
	<view class="content">
		<!-- 头部 -->
		<view  style="margin-top: 50rpx;">
			<uni-nav-bar left-icon="back" left-text="返回" 
			 title="收货地址" color='#3b71d2' @clickLeft="back" ></uni-nav-bar>
	
		</view>
		<view class="" style="z-index: -1;">
			<view class="list">
				<radio-group name="" style="z-index: -1;">
					<label style="z-index: -1;">
						<view class="li" v-for="(item,index) in data" :key='index' :style="index==data.length-1?'padding-bottom:50rpx':''">
							<view class="left">
								<radio :value="item.id" :checked="item.is_default==1?true:false"/>
							</view>
							<view class="center">
								<view class="top">
									<view class="default" v-if="item.is_default==1">
										默认
									</view>
									<view class="Large_address">
										<text>{{item.province}}</text>
										<text>{{item.city}} </text>
										<text>{{item.district}}</text>
									</view>
								</view>
								<view class="Small_address">
									{{item.address}}
								</view>
								<view class="Telephone">
									{{item.consignee}} {{item.mobile}}
								</view>
							</view>
							<view class="right"  @tap="updata_add(item.id)">
								<image src="../../static/img/our/编辑.png" mode=""></image>
							</view>
			
						</view>
			
					</label>
				</radio-group>
			</view>
			<!-- 新建地址 -->
			<view class="add_address" @tap="new_add">
				新建地址
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
                data:[],
				uid:null
			}
		},
		onLoad() {
			var uid=uni.getStorageSync('uid');
			this.getData({Uid:uid})
		},
		onShow() {
			var uid=uni.getStorageSync('uid');
			this.getData({Uid:uid})
		},
		methods: {
			// 返回上一级
           back(){
           	uni.navigateBack({
           		delta: 1
           	});
			// uni.navigateTo({
			// 	url:'../place_order/place_order?id=0'
			// })
           },
		   //新增
		   new_add(){
			   uni.navigateTo({
			   	url:'../new_address/new_address'
			   });
		   },
		   //修改
		   updata_add(id){
			   console.log(1)
		   			   uni.navigateTo({
		   			   	url:'../new_address/new_address?id='+id
		   			   });
		   },
		   //地址列表
		   getData(data){
			   this.infoprop('/Address/AddressList', 'POST', data, (res) =>{
				  this.data=res.data.data;
				  console.log(this.data)
			   });
		   }
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		.list {
			padding-bottom: 200rpx;
			.li {
				display: flex;
				justify-content: space-around;
				align-items: center;
				padding: 50rpx 0;
				border-bottom: 1px solid #EEEEEE;
				z-index: -1;
				.center {
					width: 400rpx;
					.top {
						display: flex;
						.default {
							//width: 70rpx;
							background: rgba(59, 113, 210, 1);
							border-radius: 12rpx;
							font-size: 20rpx;
							font-family: PingFang SC;
							font-weight: 400;
							color: rgba(255, 255, 255, 1);
							text-align: center;
							padding: 10rpx 10rpx;
						}

						.Large_address {
							font-size: 30rpx;
							font-family: PingFang SC;
							font-weight: 400;
							color: rgba(0, 0, 0, 1);
							text{
								margin-left: 10rpx;
							}
						}
					}

					.Small_address {
						font-size: 25rpx;
						font-family: PingFang SC;
						font-weight: 550;
						color: rgba(0, 0, 0, 1);
						letter-spacing:2rpx
					}

					.Telephone {
						font-size: 30rpx;
						font-family: PingFang SC;
						font-weight: 400;
						color: rgba(0, 0, 0, 1); 
					}
				}

				.right {
					image {
						z-index: -1;
						width: 50rpx;
						height: 50rpx;
					}
				}
			}
		}
	    //新建地址
		.add_address{
			background:rgba(98,141,219,1);
			box-shadow:0px -1px 8px 0px rgba(0, 0, 0, 0.08);
			font-size:35rpx;
			font-family:PingFang SC;
			font-weight:500;
			color:rgba(255,255,255,1);
			text-align: center;
			padding: 30rpx 0;
			width: 100%;
			position: fixed;
			bottom: 0;
			
		}
	}
</style>
